import { ARFactory } from '../axios_conf'
// eslint-disable-next-line
import { Method } from 'axios'

/**
 *  登录
 * @param {{ username, password, verify_code, identity_code }} config 基本配置
 * @param {Method} method 请求方法
 * @returns {Promise}
 */
function fetchLogin(
  config = { username, password, verify_code, identity_code },
  method = 'POST'
) {
  const url = 'login'
  return ARFactory({ url, method, data: config })
}

/**
 * 获取验证码
 * @param {{ identity_code }} identity_code 身份码
 * @returns {Promise}
 */
function fetchVerifyCode(config = { identity_code }, method = 'POST') {
  const url = 'verify_code'
  return ARFactory({ url, method, data: config })
}

export { fetchLogin, fetchVerifyCode }
